Skip to content

Fix duplicate timesteps in DPMSolverMultistepScheduler with sigma conversion methods#12788

Open
Aznix07 wants to merge 1 commit intohuggingface:mainfrom
Aznix07:fix-dpmsolver-duplicate-timesteps
Open

Fix duplicate timesteps in DPMSolverMultistepScheduler with sigma conversion methods#12788
Aznix07 wants to merge 1 commit intohuggingface:mainfrom
Aznix07:fix-dpmsolver-duplicate-timesteps

Conversation

@Aznix07
Copy link

@Aznix07 Aznix07 commented Dec 4, 2025

What does this PR do?

Fixes duplicate timesteps issue in DPMSolverMultistepScheduler when using various sigma conversion methods (Karras, Lu, exponential, beta) combined with beta_schedule="squaredcos_cap_v2".

Before this PR

  • Timesteps were not being rounded for squaredcos_cap_v2 schedule
  • This caused multiple sigma values to map to the same timestep
  • Example: timestep 998 appeared 9 times instead of once
  • Resulted in "index out of bounds" errors during sampling

After this PR

  • All sigma conversion methods now properly round timesteps
  • Duplicate timesteps are detected and removed
  • Users are warned when fewer unique timesteps are generated
  • Sampling completes without errors

Changes Made

  1. Added _ensure_unique_timesteps() helper method to handle duplicate timesteps consistently
  2. Updated all sigma conversion methods to unconditionally round timesteps
  3. Applied duplicate detection and removal to:
    • use_karras_sigmas
    • use_lu_lambdas
    • use_exponential_sigmas
    • use_beta_sigmas
  4. Added comprehensive test test_no_duplicate_timesteps_with_sigma_methods

Testing

✅ All 42 existing tests pass
✅ New test passes
✅ No regression detected
✅ Tested with multiple sigma methods and beta schedules

Fixes #12771

Before submitting

Who can review?

@yiyixuxu

@DN6 DN6 requested a review from yiyixuxu December 10, 2025 14:00
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Jan 9, 2026
@yiyixuxu yiyixuxu removed the stale Issues that haven't received updates label Jan 10, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Issues that haven't received updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DPMSolverMultistepScheduler out-of-bounds error when using beta_schedule="squaredcos_cap_v2" + use_karras_sigmas=True

2 participants